﻿Option Strict On
Option Explicit On
Option Infer On

Imports System
Imports System.Collections.Generic
Imports System.Xml.Linq
Imports GenDotNet.Task.Common
Imports GenDotNet.ObjectModel
Imports <xmlns:orm="http://kadgen.com/KADORM.xsd">

Namespace GenInputMetadata
   Public Class PropertyPrivilegeData
      Inherits BaseData
      Implements IPropertyPrivilegeData

      Private mPropertyData As IPropertyData

      Private Shared Function Load( _
               ByVal propertyData As PropertyData, _
               ByVal element As XElement) _
               As PropertyPrivilegeData
         Dim ret As New PropertyPrivilegeData(propertyData.rootdata, element)
         Return ret
      End Function

      Public Shared Function Load( _
               ByVal propertyData As PropertyData, _
               ByVal elements As IEnumerable(Of XElement)) _
               As List(Of IPropertyPrivilegeData)
         Dim ret = New List(Of IPropertyPrivilegeData)
         For Each XElement In elements
            ret.Add(Load(propertyData, XElement))
         Next
         Return ret
      End Function

      Private Sub New(ByVal rootData As RootData, _
                      ByVal element As XElement)
         MyBase.New(rootData, element)

      End Sub

      Public ReadOnly Property CanEdit() As Boolean Implements IPropertyPrivilegeData.CanEdit
         Get
            Return Element.@Edit.IsTrue
         End Get
      End Property

      Public ReadOnly Property Grantee() As String Implements IPropertyPrivilegeData.Grantee
         Get
            Return Element.@Grantee
         End Get
      End Property

      Public ReadOnly Property CanSee() As Boolean Implements IPropertyPrivilegeData.CanSee
         Get
            Return Element.@Visible.IsTrue
         End Get
      End Property
   End Class
End Namespace